package cn.codergege.demo

import cn.codergege.demo.ocr.OcrUtils
import org.springframework.boot.CommandLineRunner
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import java.io.File
import javax.imageio.ImageIO

@SpringBootApplication
class OcrAspriseDemoApplication: CommandLineRunner {
    override fun run(vararg args: String?) {
        val ocrUtils = OcrUtils()
        val classLoader = javaClass.classLoader
        val path = classLoader.getResource("testocr.png").path
        val img = ImageIO.read(File(path))
        val result = ocrUtils.recognize(img)
        println("-----------------")
        println(result)
        println("-----------------")
    }
}

fun main(args: Array<String>) {
    runApplication<OcrAspriseDemoApplication>(*args)
}
